load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

go_library(
    name = "go_default_library",
    srcs = ["main.go"],
    importpath = "kubevirt.io/kubevirt/cmd/sidecars/network-slirp-binding",
    visibility = ["//visibility:private"],
    deps = [
        "//cmd/sidecars/network-slirp-binding/dns:go_default_library",
        "//cmd/sidecars/network-slirp-binding/server:go_default_library",
        "//pkg/hooks:go_default_library",
        "//pkg/hooks/info:go_default_library",
        "//pkg/hooks/v1alpha2:go_default_library",
        "//staging/src/kubevirt.io/client-go/log:go_default_library",
        "//vendor/google.golang.org/grpc:go_default_library",
    ],
)

go_binary(
    name = "network-slirp-binding",
    embed = [":go_default_library"],
    visibility = ["//visibility:public"],
)

pkg_tar(
    name = "get-version",
    srcs = ["//:get-version"],
    package_dir = "/",
)

pkg_tar(
    name = "network-slirp-binding-tar",
    srcs = [":network-slirp-binding"],
    package_dir = "/",
)

oci_image(
    name = "version-container",
    base = "//:passwd-image",
    tars = [
        ":get-version",
    ],
)

oci_image(
    name = "network-slirp-binding-image",
    base = ":version-container",
    entrypoint = ["/network-slirp-binding"],
    tars = [
        ":network-slirp-binding-tar",
    ],
    visibility = ["//visibility:public"],
)
